<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="echartsJs/echarts.js"></script>
    <script src="jq/jquery.js"></script>
    <style>
        .box {
            width: 600px;
            height: 400px;
            display: block;
            border: 1px solid #999;
        }
    </style>
</head>

<body>

    <div class="box" id="box1"></div>
    <input type="button" value="重新载入数据" onclick="loadData()">
    <script>
        let box1Dom=document.getElementById("box1");
        let chartBox1=echarts.init(box1Dom);
        function initEcharts(data){
            chartBox1.setOption({
                lengend:{},
                tooltip:{},
                dataset:{
                    source:data.list
                },
                xAxis: { type: 'category' },
                yAxis: {},
                series:[{type:"bar"},{type:"bar"},{type:"bar"},{type:"bar"}]

            });
            chartBox1.hideLoading();
        }

        async function loadData(){
            chartBox1.showLoading({text:"正在加载数据......",color:"#a345ab"});
            let res=await $.ajax({url:"./data/data2.json"}).promise();
            initEcharts(res);
        }
    </script>


</body>

</html>